<?xml version="1.0" encoding="UTF-8"?>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	template="/WEB-INF/templates/default.xhtml">

	<ui:define name="menu">
		<ul>
			<li><h:link value="Home"  outcome="/index" /> </li>
			<li><h:link value="Users"  outcome="/content/user/list" /> </li>
			<li><h:link value="Resources"  outcome="/content/resource/list" /> </li>
		    <li><h:link class="akt" value="Tasks"  outcome="/content/task/list" /> </li> 
		    <li><h:link value="Task types"  outcome="/content/tasktype/list" /> </li>		    
		</ul>
		<p class="vonal"><br/></p>
	</ui:define>

	<ui:define name="content2">		
		<h:form id="taskListForm">

			<h:outputLabel for="tasktypet" value="Type:   "  style="margin-left:190px; color:red;"/>
			<h:selectOneMenu converter="#{taskTypeBean.converter}" id="tasktypet"
				value="#{tasksListBean.taskType}"
				style="background-color:#F5FFFA; width: 150px;">
				<f:selectItems value="#{taskTypeListBean.loadAllTaskTypes()}"
					var="type" itemValue="#{type}" itemLabel="#{type.name}" />
			</h:selectOneMenu>
			<h:message for="tasktypet" styleClass="error" />

			<h:commandButton action="#{tasksListBean.searchActionByType()}"
				value="Search"
				style="background-color:#F5FFFA; width: 100px;margin-left: 50px;" />

			<br/><br/>

			<h:dataTable id="taskTable"
				value="#{tasksListBean.tasks}" var="task"
				styleClass="taskTable" columnClasses="taskTableName, taskTableEstimated, taskTableRemaining, taskTableCompleted, taskTableType, taskTableUserName"
				rowClasses="userTableOddRow, userTableEvenRow">

				<h:column headerClass="taskTableHeaderName">
					<f:facet name="header">Name</f:facet>
					<h:link outcome="/content/task/edit" value="##{task.id}:  #{task.name}">
						<f:param name="id" value="#{task.id}" />
					</h:link>
				</h:column>

				<h:column headerClass="taskTableHeaderEstimated">
					<f:facet name="estimated">estimated</f:facet>
					<h:outputText value="#{task.estimated}" />
				</h:column>

				<h:column headerClass="taskTableHeaderRemaining">
					<f:facet name="estimated">remaining</f:facet>
					<h:outputText value="#{task.remaining}" />
				</h:column>

				<h:column headerClass="taskTableHeaderCompleted">
					<f:facet name="header">Completed</f:facet>
					<h:outputText value="#{task.completed}" />
				</h:column>

				<h:column headerClass="taskTableHeaderType">
					<f:facet name="header">Type</f:facet>
					<h:outputText value="#{task.taskType.name}" />
				</h:column>
			
				<h:column headerClass="taskTableHeaderUserName">
					<f:facet name="header">User</f:facet>
					<h:outputText value="#{task.user.name}" />
				</h:column>				
			
			</h:dataTable>
			<br />
		</h:form>
	</ui:define>
</ui:composition>
